NSObject

extension Reactive where Base: NSObject

The reactive extension can be accessed through the reactive instance property and the reactive static property.

  • Undocumented

    Declaration

    Swift

    extension Reactive where Base: NSObject
  • Creates a binding target which uses the lifetime of the object, and weakly references the object so that the supplied action is triggered only if the object has not deinitialized.

    Declaration

    Swift

    public func makeBindingTarget<U>(on scheduler: Scheduler = UIScheduler(), _ action: @escaping (Base, U) -> Void) -> BindingTarget<U>

    Parameters

    scheduler

    An optional scheduler that the binding target uses. If it is not specified, a UI scheduler would be used.

    action

    The action to consume values from the bindings.

    Return Value

    A binding target that holds no strong references to the object.

  • Create a signal which sends a next event at the end of every invocation of selector on the object.

    It completes when the object deinitializes.

    Note

    Observers to the resulting signal should not call the method specified by the selector.

    Declaration

    Swift

    public func trigger(for selector: Selector) -> Signal<(), NoError>

    Parameters

    selector

    The selector to observe.

    Return Value

    A trigger signal.

  • Create a signal which sends a next event, containing an array of bridged arguments, at the end of every invocation of selector on the object.

    It completes when the object deinitializes.

    Note

    Observers to the resulting signal should not call the method specified by the selector.

    Declaration

    Swift

    public func signal(for selector: Selector) -> Signal<[Any?], NoError>

    Parameters

    selector

    The selector to observe.

    Return Value

    A signal that sends an array of bridged arguments.

  • Returns a lifetime that ends when the object is deallocated.

    Declaration

    Swift

    @nonobjc public var lifetime: Lifetime
  • Create a producer which sends the current value and all the subsequent changes of the property specified by the key path.

    The producer completes when the object deinitializes.

    Declaration

    Swift

    public func producer(forKeyPath keyPath: String) -> SignalProducer<Any?, NoError>

    Parameters

    keyPath

    The key path of the property to be observed.

    Return Value

    A producer emitting values of the property specified by the key path.

  • Create a signal all changes of the property specified by the key path.

    The signal completes when the object deinitializes.

    Note

    Does not send the initial value. See producer(forKeyPath:).

    Declaration

    Swift

    public func signal(forKeyPath keyPath: String) -> Signal<Any?, NoError>

    Parameters

    keyPath

    The key path of the property to be observed.

    Return Value

    A producer emitting values of the property specified by the key path.